/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package l1j.server.server.templates;

import java.sql.Timestamp;

import l1j.server.Config;

/**
 * ログインの為の様々なインターフェースを提供する.
 */
public class L1Account {
	private String _login;// 帳號

	private String _password;// 密碼

	private String _nouncodeps;// 未加密的密碼

	private Timestamp _lastactive;// 最後登入時間

	private int _access_level;// 帳戶等級

	private String _ip;// 登入IP

	private String _mac;// 登入MAC

	private int _character_slot;// 人物擴充

	// private String _spw;// 超級密碼

	private int _warehouse = -256;// 倉庫密碼

	private int _countCharacters;// 已創人物數量

	private boolean _isLoad;// 帳戶已登入
	
	private boolean _isbanned;
	
	private int _onlineTime; //累積在線時間(分)
	
	public boolean isBanned(){
		return _isbanned;
	}
	public void setBanned(final int i){
		_isbanned = i>0;
	}
	

	/**
	 * 帳戶等級
	 *
	 * @return 傳出 _access_level
	 */
	public int get_access_level() {
		return this._access_level;
	}

	/**
	 * 人物擴充
	 *
	 * @return 傳出 _character_slot
	 */
	public int get_character_slot() {
		return this._character_slot;
	}

	/**
	 * 已創人物數量
	 *
	 * @return 傳出 _countCharacters
	 */
	public int get_countCharacters() {
		return this._countCharacters;
	}

	/**
	 * 登入IP
	 *
	 * @return 傳出 _ip
	 */
	public String get_ip() {
		return this._ip;
	}

	/**
	 * 最後登入時間
	 *
	 * @return 傳出 _lastactive
	 */
	public Timestamp get_lastactive() {
		return this._lastactive;
	}

	/**
	 * 帳號
	 *
	 * @return 傳出 _login
	 */
	public String get_login() {
		return this._login;
	}

	/**
	 * 登入MAC
	 *
	 * @return 傳出 _mac
	 */
	public String get_mac() {
		return this._mac;
	}

	/**
	 * 取得加密之前的密碼
	 * */
	public String get_NoUncodesPSW() {
		return this._nouncodeps;
	}

	/**
	 * 密碼
	 *
	 * @return 傳出 _password
	 */
	public String get_password() {
		return this._password;
	}

	/**
	 * 倉庫密碼
	 *
	 * @return 傳出 _warehouse
	 */
	public int get_warehouse() {
		return this._warehouse;
	}

	/**
	 * 帳戶已登入
	 *
	 * @return 傳出 _isLoad true:登入 false:未登入
	 */
	public boolean is_isLoad() {
		return this._isLoad;
	}

	/**
	 * 帳戶等級
	 *
	 * @param access_level
	 *            對 _access_level 進行設置
	 */
	public void set_access_level(int access_level) {
		this._access_level = access_level;
	}

	/**
	 * 人物擴充
	 *
	 * @param character_slot
	 *            對 _character_slot 進行設置
	 */
	public void set_character_slot(int character_slot) {
		this._character_slot = character_slot;
	}

	/**
	 * 已創人物數量
	 *
	 * @param characters
	 *            對 _countCharacters 進行設置
	 */
	public void set_countCharacters(int characters) {
		this._countCharacters = characters;
	}

	/**
	 * 登入IP
	 *
	 * @param ip
	 *            對 _ip 進行設置
	 */
	public void set_ip(String ip) {
		this._ip = ip;
	}

	/**
	 * @param load
	 *            對 _isLoad 進行設置
	 */
	public void set_isLoad(boolean load) {
		this._isLoad = load;
	}

	/**
	 * 超級密碼
	 *
	 * @return 傳出 _spw
	 */
	// public String get_spw() {
	// return _spw;
	// }

	/**
	 * 超級密碼
	 *
	 * @param spw
	 *            對 _spw 進行設置
	 */
	// public void set_spw(String spw) {
	// this._spw = spw;
	// }

	/**
	 * 最後登入時間
	 *
	 * @param lastactive
	 *            對 _lastactive 進行設置
	 */
	public void set_lastactive(Timestamp lastactive) {
		this._lastactive = lastactive;
	}

	/**
	 * 帳號
	 *
	 * @param login
	 *            對 _login 進行設置
	 */
	public void set_login(String login) {
		this._login = login;
	}

	/**
	 * 登入MAC
	 *
	 * @param mac
	 *            對 _mac 進行設置
	 */
	public void set_mac(String mac) {
		this._mac = mac;
	}

	/**
	 * 設定加密之前的密碼
	 * */
	public void set_NoUncodePSW(String password) {
		this._nouncodeps = password;
	}

	/**
	 * 密碼
	 *
	 * @param password
	 *            對 _password 進行設置
	 */
	public void set_password(String password) {
		this._password = password;
	}

	/**
	 * 倉庫密碼
	 *
	 * @param warehouse
	 *            對 _warehouse 進行設置
	 */
	public void set_warehouse(int warehouse) {
		this._warehouse = warehouse;
	}
	private int _srcOnlineTime;
	
	public void setOnlineTime(int time){
		_onlineTime = time;
	}
	public void defaultOnlineTime(){
		_srcOnlineTime = _onlineTime;
	}
	public void addOnlineTime(){
		_onlineTime +=Config.GIT;
	}
	public boolean onlineTimeSave(){
		return _srcOnlineTime != _onlineTime;
	}
	public int getOnlineTime(){
		return _onlineTime;
	}

}
